package com.xyx.ssm.jdbcdao;

import java.util.Map;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.xyx.ssm.model.MyBatisPaginate;
import com.xyx.ssm.util.Page;
@Repository
public class BaseDao{
	@Autowired
	SqlSessionTemplate sqlSession;
	
	@Autowired
	MyBatisPaginate myBatisPaginate;
	
	public Page<Map<String,Object>> findPage(String sqlid,Page<Map<String,Object>> page1){
		
		//2sql
/*		Map<String,Object> map=page1.getParam();
		
		int startPos=(page1.getPageNow()-1)*page1.getPageSize();
		
		map.put("startPos", startPos);
		
		map.put("pageSize", page1.getPageSize());
		
		List list=sqlSession.selectList("com.xyx.ssm.dao.UserMapper1.selectlist", map);
		
		int num=sqlSession.selectOne("com.xyx.ssm.dao.UserMapper1.getProductsCount");
		
		page1.setList(list);
		page1.setTotalCount(num);*/
		
		Page<Map<String,Object>> page=null;
		page =myBatisPaginate.execQueryPage(sqlid, page1);
		return page1;
	}
	

}
